﻿namespace CN2P.Web.Controllers.Api.Proxy
{
    using System.Collections.Generic;
    using System.Web.Http;
    using CN2P.ServiceModel;

    public class OrdersApiProxyController : BaseApiProxyController
    {
        [AcceptVerbs("GET")]
        public IList<OrderModel> Get(string userId)
        {
            var decodedUserId = this.DecodeUserId(userId);
            var res = client.OrdersService.GetUserOrders(decodedUserId);
            return res;
        }

        [AcceptVerbs("GET")]
        public OrderModel GetOrder(string userId, string orderId)
        {
            var decodedUserId = this.DecodeUserId(userId);
            var res = client.OrdersService.GetUserOrder(decodedUserId, orderId);
            return res;
        }

        [AcceptVerbs("DELETE")]
        public void DeleteAll()
        {
            client.OrdersService.DeleteAll();
        }
    }
}